//
//  MHCommonCollectionViewBoxView.m
//  MiaoCircle
//
//  Created by 许正荣 on 2018/10/15.
//  Copyright © 2018年 acgera. All rights reserved.
//

#import "MHCommonCollectionViewBoxView.h"
@interface MHCommonCollectionViewBoxView()

@end
@implementation MHCommonCollectionViewBoxView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self initializeViews];
    }
    return self;
}

-(instancetype)initWithFrame:(CGRect)frame layout:(CHTCollectionViewWaterfallLayout *)layout dataSouce:(MHDataSource *) dataSouce
{
    self = [super initWithFrame:frame];
    if (self) {
        self.layout = layout;
        self.dataSource = dataSouce;
        
        [self initializeViews];
    }
    return self;
}

- (instancetype)initWithCoder:(NSCoder *)coder
{
    self = [super initWithCoder:coder];
    if (self) {
        [self initializeViews];
    }
    return self;
}



-(void) initializeViews
{
    
    self.collectionView = [[MHCollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:self.layout];
    _collectionView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
    _collectionView.backgroundColor = [UIColor clearColor];
    _collectionView.showsVerticalScrollIndicator = NO;
    _collectionView.userInteractionEnabled = YES;
    [_collectionView registerClass:[UICollectionViewCell class]
        forCellWithReuseIdentifier:@"UICollectionCell"];
    self.dataSource.collectionView = self.collectionView;
    [self addSubview:_collectionView];
    [_collectionView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self);
    }];
    
    self.splitLine = [[UIView alloc] init];
    self.splitLine.backgroundColor = WXGlobalBottomLineColor;
    [self addSubview:self.splitLine];
    [self.splitLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self);
        make.right.equalTo(self);
        make.bottom.equalTo(self.collectionView);
        make.height.mas_equalTo(0.5);
    }];
    
    
}




@end
